home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / gfx / edit / VE-addspace.lha / arexx / AddSpace.rexx
OS/2 REXX Batch file  |  1999-01-16  |  2KB  |  124 lines

  1. /*
  2.  
  3.    v1.61 AddSpace
  4.  
  5.    Marko Seppänen
  6.    marko.seppanen@wwnet.fi
  7.  
  8. */
  9.  
  10.  
  11. address IMAGEENGINEER
  12.  
  13. Options results
  14. signal on error            /* Setup a place for errors to go */
  15.  
  16.  
  17. if arg()=0 then exit
  18. x=arg(1)
  19. pic=subword(x,1,1)
  20. value=subword(x,2,1)
  21. bg=subword(x,3,1)
  22. if bg=BLACK then bg=1
  23. if bg=WHITE then bg=0
  24. if bg=GUESS then bg=2
  25.  
  26.  
  27. MARK pic PRIMARY
  28. PROJECT_INFO pic WIDTH
  29. picwidth=result
  30. PROJECT_INFO pic HEIGHT
  31. picheight=result
  32. PROJECT_INFO pic ZOOM
  33. origzoomval=result
  34.  
  35.  
  36. if bg="" then do
  37.  
  38.   if exists("ie:prefs/veaddspace.cfg") == "1" then
  39.     do
  40.       call open("temp","ie:prefs/veaddspace.cfg","R")
  41.       values=readln("temp")
  42.       parse var values ok bg value .
  43.       call close("temp")
  44.     end
  45.   else
  46.     do
  47.       bg=0
  48.       value=20
  49.     end
  50.  
  51.   'FORM "Add Space" "Use|Cancel"',
  52.   'CYCLE,"Background color","White|Black|Guess",'bg'',
  53.   'INTEGER,"Space to add",1,1000,'value',SLIDER'
  54.  
  55.   values=result
  56.   parse var values ok bg value .
  57.  
  58.   if ok = 0 then exit
  59.  
  60.   call open("temp","ie:prefs/veaddspace.cfg","W")
  61.   res=writeln("temp",values)
  62.   call close("temp")
  63.  
  64. end
  65.  
  66.  
  67.  
  68. if bg == 0 then do
  69.     BRIGHTNESS pic 255
  70.     bgcolor=result
  71.     RESIZE bgcolor picwidth+(value*2) picheight+(value*2) TILE
  72.     bgcolor2=result
  73.     CLOSE bgcolor
  74.     MARK bgcolor2 SECONDARY
  75.     COMPOSITE value value MIN
  76.     pic2=result
  77. end
  78. if bg == 1 then do
  79.     BRIGHTNESS pic "-255"
  80.     bgcolor=result
  81.     RESIZE bgcolor picwidth+(value*2) picheight+(value*2) TILE
  82.     bgcolor2=result
  83.     CLOSE bgcolor
  84.     MARK bgcolor2 SECONDARY
  85.     COMPOSITE value value MAX
  86.     pic2=result
  87. end
  88. if bg == 2 then do
  89.     CROP pic picwidth-1 picheight-1 picwidth-1 picheight-1
  90.     bgpixel=result
  91.     RESIZE bgpixel picwidth+(value*2) picheight+(value*2) TILE
  92.     bgcolor2=result
  93.     CLOSE bgpixel
  94.     MARK bgcolor2 SECONDARY
  95.     COMPOSITE value value MIX 100
  96.     pic2=result
  97. end
  98.  
  99. CLOSE bgcolor2
  100.  
  101.  
  102. PROJECT_SET pic2 ZOOM origzoomval
  103.  
  104.  
  105. exit
  106.  
  107. /*******************************************************************/
  108. /* This is where control goes when an error code is returned by IE */
  109. /* It puts up a message saying what happened and on which line     */
  110. /*******************************************************************/
  111. error:
  112. if RC=5 then do            /* Did the user just cancel us? */
  113.     IE_TO_FRONT
  114.     LAST_ERROR
  115.     'REQUEST "'||RESULT||'"'
  116.     exit
  117. end
  118. else do
  119.     IE_TO_FRONT
  120.     LAST_ERROR
  121.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  122.     exit
  123. end
  124.